﻿#ifndef _NET_MAP_SOCKET_H_
#define _NET_MAP_SOCKET_H_

#include <stdexcept>
#include <functional>
#include <string>
#include "RawIoInterface.h"

struct nmport_d;

class NetMapSocket : public RawIoInterface
{
public:

    explicit NetMapSocket(const std::string& ifname);
    virtual ~NetMapSocket();

    virtual int SendData(DataCache& data, int timeout);
    virtual int RecvData(DataCache& data, int timeout);

private:

    int send_data(struct netmap_ring* ring, void* frame, int per_frame, int all_size);
    int recv_data(struct netmap_ring* ring, DataCache& data);

private:
    struct nmport_d* m_nmd; /* 通信句柄 */
};




#endif